package com.wms.auto;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

public class CreateUtils {

	public static String getNameToAaA(String str) {
		
		String toStr = "";
		
		String[] toStrs = StringUtils.split(str, "_");
		
		for (String tStr : toStrs) {
			toStr += StringUtils.capitalize(tStr);
		}
		
		return toStr;
	}
	
	public static String getNameToaaA(String str) {
		
		String[] toStrs = StringUtils.split(str, "_");
		
		String toStr = toStrs[0];
		
		for (int i = 1; i < toStrs.length; i++) {
			toStr += StringUtils.capitalize(toStrs[i]);
		}
		
		return toStr;
	}
	
	public static String getNameTogetAaA(String str) {
		
		String toStr = "get" + getNameToAaA(str) + "";
		
		return toStr;
	}
	
	public static String getNameTosetAaA(String str) {
		
		String toStr = "set" + getNameToAaA(str) + "";
		
		return toStr;
	}
	
	public static String getNameToA_A(String str) {
		
		String toStr = "";
		
		toStr = StringUtils.upperCase(str);
		
		return toStr;
	}
	
	public static String getType(String str) {
		
		String toStr = "";
		
		toStr = getTypeMap().get(StringUtils.upperCase(str));
		
		return toStr;
	}
	
	private static Map<String, String> getTypeMap() {
		
		Map<String, String> typeMap = new HashMap<String, String>();
		
		typeMap.put("VARCHAR", "String");
		typeMap.put("CHAR", "String");
		typeMap.put("DATETIME", "Date");
		typeMap.put("DECIMAL", "double");
		typeMap.put("INTEGER", "int");
		typeMap.put("INTEGER", "int");
		
		return typeMap;
	}
}